package com.trade.common.utils;

/**
 * Description:向页面返回的结果信息
 *  respCode:返回码;
 *  respMsg:返回信息描述;
 *  dataObj:Object类型，返回的数据信息
 *
 * @JDK Version:1.8.0_40
 * Version: V1.0
 * Author: lsk
 * Date: 2016/3/21 0021 17:33
 */
public class ResponseBean<T> {
    /**返回码**/
    private String respCode;

    /**描述信息**/
    private String respMsg;

    /**返回结果或返回结果集合**/
    private T dataObj;

    /**
     * 重载构造方法
     */
    public ResponseBean(String respCode, String respMsg, T dataObj){
        this.respCode = respCode;
        if (XaUtil.isEmpty(respMsg)){
            this.respMsg = ResponseUtil.getMsg(respCode);
        }else{
            this.respMsg = respMsg;
        }
        this.dataObj = dataObj;
    }
    /**
     * 重载构造方法,不需要传信息描述，系统自动构建
     */
    public ResponseBean(String respCode, T dataObj){
        this.respCode = respCode;
        this.respMsg = ResponseUtil.getMsg(respCode);
        this.dataObj = dataObj;
    }
    /**
     * 重载构造方法,不需要传信息描述，系统自动构建
     */
    public ResponseBean(String respCode){
        this.respCode = respCode;
        this.respMsg = ResponseUtil.getMsg(respCode);
    }
    /**
     * 重载构造方法,不需要传信息描述，系统自动构建
     */
    public ResponseBean(String respCode, String respMsg){
        this.respCode = respCode;
        if (XaUtil.isEmpty(respMsg)){
            this.respMsg = ResponseUtil.getMsg(respCode);
        }else{
            this.respMsg = respMsg;
        }
    }

    public String getRespCode() {
        return respCode;
    }

    public void setRespCode(String respCode) {
        this.respCode = respCode;
    }

    public String getRespMsg() {
        return respMsg;
    }

    public void setRespMsg(String respMsg) {
        this.respMsg = respMsg;
    }

    public T getDataObj() {
        return (T)dataObj;
    }

    public void setDataObj(T dataObj) {
        this.dataObj = dataObj;
    }
}
